<template>
  <el-tabs v-model="activeName" @tab-click="handleClick">
    <el-tab-pane label="分佣提现" name="first">
      <div style="margin: 2% 0; display: inline-block">
        <div style="position: relative; display: inline-block">
          <el-input
            style="width: 200px"
            @keydown.enter.native="zfbselect"
            placeholder="请输入支付宝号查询"
            v-model="zhifubao"
          ></el-input
          >&nbsp;&nbsp;
          <span
            @click="zfbselect"
            style="position: absolute; right: 18px; top: 8px"
            ><icon-svg name="shousuo" class="site-sidebar__menu-icon"></icon-svg
          ></span>
        </div>
      </div>
      <div style="display: inline-block">
        <el-button
          style="margin: 0 0 20px 20px"
          size="mini"
          type="primary"
          icon="document"
          @click="transferClcik()"
          :disabled="
            checkBoxData.length <= 0 || !isAuth('financeList:accounts')
          "
          >批量转账
        </el-button>
        <!-- <el-button style='margin:0 0 20px 20px;' :disabled="!isAuth('financeList:statement')" size="mini" type="primary"
		                   icon="document" @click="close()">开始结算
		        </el-button> -->
        <el-button
          style="margin-left: 15px"
          size="mini"
          type="primary"
          icon="document"
          @click="cleans"
          >重置</el-button
        >
      </div>
      <el-table
        @selection-change="changeFun"
        v-loading="tableDataLoading"
        :data="tableData"
      >
        <el-table-column type="selection"> </el-table-column>
        <el-table-column fixed prop="id" label="编号" width="80">
        </el-table-column>
        <el-table-column fixed prop="relationId" label="用户等级" width="120">
          <template slot-scope="scope">
            <span
              style="color: #4f9dec; cursor: pointer"
              @click="updates(scope.row)"
              >{{ scope.row.relationId }}</span
            >
          </template>
        </el-table-column>
        <el-table-column prop="zhifubao" label="支付宝" width="150">
        </el-table-column>
        <el-table-column prop="zhifubaoName" label="姓名" width="100">
        </el-table-column>
        <el-table-column prop="money" label="提现金额" width="100">
        </el-table-column>
        <el-table-column prop="state" label="状态" width="100">
          <template slot-scope="scope">
            <span
              style="color: #4f9dec; cursor: pointer"
              v-if="scope.row.state == 0"
              >待转账</span
            >
            <span v-if="scope.row.state == 1">已转账</span>
            <span v-if="scope.row.state == -1">已退款</span>
          </template>
        </el-table-column>
        <el-table-column prop="refund" label="退款原因" width="220">
        </el-table-column>
        <!-- <el-table-column
				  prop="refund"
				  label="类型"
				  width="100">
				</el-table-column> -->
        <el-table-column prop="createAt" label="申请时间" width="170">
        </el-table-column>
        <el-table-column prop="outAt" label="转账/退款时间" width="180">
        </el-table-column>
        <el-table-column prop="orderNumber" label="转账订单号" width="150">
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="280">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              :disabled="!isAuth('financeList:accounts')"
              @click="batch(scope.row)"
              >支付宝转账
            </el-button>
            <el-button
              v-if="scope.row.paymentCode"
              size="mini"
              type="primary"
              :disabled="!isAuth('financeList:accounts')"
              @click="batchWechat(scope.row)"
              >微信转账
            </el-button>
            <el-button
              size="mini"
              type="primary"
              :disabled="!isAuth('financeList:refund')"
              @click="refund(scope.row)"
              >退款
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div style="text-align: center; margin-top: 10px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5, 10, 15]"
          :page-size="size"
          :current-page="page"
          layout="total,sizes, prev, pager, next"
          :total="totalnum"
        >
        </el-pagination>
      </div>
      <!-- 退款弹框 -->
      <el-dialog title="退款" :visible.sync="dialogFormVisible" center>
        <el-form :model="form">
          <el-form-item label="退款原因：" :label-width="formLabelWidth">
            <el-input
              v-model="form.content"
              type="textarea"
              rows="4"
              placeholder="请输入退款原因"
              style="width: 65%"
            ></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="refundNoticeTo()">确 定</el-button>
        </div>
      </el-dialog>
      <!-- 微信转账弹窗 -->
      <we-pay-dialog
        ref="wepayDialogRef"
        @confirm="confirmBatchWechat(batchWechatDialogData.cashId)"
        :wepayQRCodeImgSrc="batchWechatDialogData.paymentCode"
        :confirmAutoClose="false"
      >
      </we-pay-dialog>
    </el-tab-pane>
    <el-tab-pane label="奖金提现" name="eighth">
      <BonusWithdrawal></BonusWithdrawal>
    </el-tab-pane>
    <el-tab-pane label="提现统计" name="third">
      <div>
        <el-select
          v-model="way"
          style="width: 150px; margin-left: 10px"
          @change="animeDat"
        >
          <el-option
            v-for="item in ways"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option> </el-select
        >&nbsp;&nbsp;&nbsp;
        <el-date-picker
          style="width: 160px; margin-left: 10px"
          v-model="info.stockDate"
          align="right"
          type="datetime"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          placeholder="选择开始时间"
          @change="timeDate"
        >
        </el-date-picker>
        &nbsp;&nbsp;&nbsp;
      </div>
      <el-row>
        <el-col :span="6" class="cards">
          <div class="box">
            <div class="box_num">
              <div class="box_color">累计提现金额</div>
              <div class="text_color" v-if="!isNaN(sumMoneyByTime)">
                <span>{{ sumMoneyByTime ? sumMoneyByTime : 0 }}</span
                >元
              </div>
              <div class="text_color" v-if="isNaN(sumMoneyByTime)">
                <span>0</span>元
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="6" class="cards">
          <div class="box">
            <div class="box_num">
              <div class="box_color">提现笔数</div>
              <div class="text_color">
                <span>{{
                  withdrawData && withdrawData.countNumberByTime
                    ? withdrawData.countNumberByTime
                    : 0
                }}</span
                >笔
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="6" class="cards">
          <div class="box">
            <div class="box_num">
              <div class="box_color">待转账人数</div>
              <div
                class="text_color"
                v-if="withdrawData && withdrawData.notOutMoneyByTime"
              >
                <span>{{ withdrawData.notOutMoneyByTime }}</span
                >人
              </div>
              <div class="text_color" v-else><span>0</span>人</div>
            </div>
          </div>
        </el-col>
      </el-row>
    </el-tab-pane>
    <el-tab-pane label="领奖统计" name="ninth">
      <CollectStatistics></CollectStatistics>
    </el-tab-pane>
    <el-tab-pane label="充值记录" name="second">
      <el-table v-loading="tableDataLoading" :data="rechargeData">
        <el-table-column fixed prop="id" label="编号" width="80">
        </el-table-column>
        <el-table-column prop="userId" label="会员编号">
          <template slot-scope="scope">
            <span
              style="color: #4f9dec; cursor: pointer"
              @click="updates(scope.row)"
              >{{ scope.row.userId ? scope.row.userId : "null" }}</span
            >
          </template>
        </el-table-column>
        <el-table-column prop="money" label="充值金额"> </el-table-column>
        <el-table-column prop="title" label="充值标题"> </el-table-column>
        <el-table-column prop="content" label="充值内容"> </el-table-column>
        <el-table-column prop="createTime" label="创建时间" width="160">
        </el-table-column>
      </el-table>
      <div style="text-align: center; margin-top: 10px">
        <el-pagination
          @size-change="handleSizeChange1"
          @current-change="handleCurrentChange1"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="size"
          :current-page="page"
          layout="total,sizes, prev, pager, next"
          :total="totalnum2"
        >
        </el-pagination>
      </div>
    </el-tab-pane>
    <el-tab-pane label="充值统计" name="statis">
      <el-row>
        <el-col :span="6" class="cards">
          <div class="box">
            <div class="box_num">
              <div class="box_color">累计总收入</div>
              <div class="text_color">
                <span>{{ statisData.sum0 ? statisData.sum0 : 0 }}</span
                >元
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="6" class="cards">
          <div class="box">
            <div class="box_num">
              <div class="box_color">微信总收入</div>
              <div class="text_color">
                <span>{{ statisData.sum4 ? statisData.sum4 : 0 }}</span
                >元
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="6" class="cards">
          <div class="box">
            <div class="box_num">
              <div class="box_color">支付宝总收入</div>
              <div class="text_color">
                <span>{{ statisData.sum5 ? statisData.sum5 : 0 }}</span
                >元
              </div>
            </div>
          </div>
        </el-col>
      </el-row>
      <div>
        <span style="margin-left: 8px">选择日期:</span>
        <div style="display: inline-block">
          <el-date-picker
            style="width: 160px; margin-left: 10px"
            v-model="info.stockDate"
            align="right"
            type="datetime"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            placeholder="选择开始时间"
            @change="animeOrder"
          >
          </el-date-picker>
        </div>
        <el-row>
          <el-col :span="6" class="cards">
            <div class="box">
              <div class="box_num">
                <div class="box_color">年收入</div>
                <div class="text_color">
                  <span>{{ statisData.sum1 ? statisData.sum1 : 0 }}</span
                  >元
                </div>
              </div>
            </div>
          </el-col>
          <el-col :span="6" class="cards">
            <div class="box">
              <div class="box_num">
                <div class="box_color">月收入</div>
                <div class="text_color">
                  <span>{{ statisData.sum2 ? statisData.sum2 : 0 }}</span
                  >元
                </div>
              </div>
            </div>
          </el-col>
          <el-col :span="6" class="cards">
            <div class="box">
              <div class="box_num">
                <div class="box_color">日收入</div>
                <div class="text_color">
                  <span>{{ statisData.sum3 ? statisData.sum3 : 0 }}</span
                  >元
                </div>
              </div>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-tab-pane>
    <el-tab-pane label="转赠记录" name="fifth">
      <div style="margin: 2% 0; display: inline-block">
        <span>转赠人手机号:</span>
        <el-input
          style="width: 150px"
          @keydown.enter.native="increaseSelect"
          clearable
          placeholder="请输入手机号"
          v-model="userPhone"
        ></el-input
        >&nbsp;&nbsp;&nbsp;&nbsp;
        <span>接受转赠人手机号:</span>
        <el-input
          style="width: 150px"
          @keydown.enter.native="increaseSelect"
          clearable
          placeholder="请输入手机号"
          v-model="userPhoneTo"
        ></el-input
        >&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <div style="display: inline-block">
        <el-button
          style="margin-left: 15px"
          size="mini"
          type="primary"
          icon="document"
          @click="selectincrease"
          >查询</el-button
        >
        <el-button
          style="margin-left: 15px"
          size="mini"
          type="primary"
          icon="document"
          @click="cleansincrease"
          >重置</el-button
        >
      </div>
      <el-table v-loading="tableDataLoading" :data="increaseDate.content">
        <el-table-column fixed prop="id" label="编号" width="80">
        </el-table-column>
        <el-table-column prop="userPhone" label="转赠人手机号">
          <template slot-scope="scope">
            <span
              style="color: #4f9dec; cursor: pointer"
              @click="updatesPhone(scope.row)"
              >{{ scope.row.userPhone ? scope.row.userPhone : "未绑定" }}</span
            >
          </template>
        </el-table-column>
        <el-table-column prop="userName" label="转赠人昵称"> </el-table-column>
        <el-table-column prop="userPhoneTo" label="接受转赠人手机号">
          <template slot-scope="scope">
            <span
              style="color: #4f9dec; cursor: pointer"
              @click="updatesPhoneTo(scope.row)"
              >{{
                scope.row.userPhoneTo ? scope.row.userPhoneTo : "未绑定"
              }}</span
            >
          </template>
        </el-table-column>
        <el-table-column prop="userNameTo" label="接受转赠人昵称">
        </el-table-column>
        <el-table-column prop="money" label="转赠总金额"> </el-table-column>
        <el-table-column prop="chargeMoney" label="转赠手续费">
        </el-table-column>
        <el-table-column prop="acceptMoney" label="实际转赠金额">
        </el-table-column>
        <el-table-column prop="createTime" label="转赠时间" width="160">
        </el-table-column>
      </el-table>
      <div style="text-align: center; margin-top: 10px">
        <el-pagination
          @size-change="handleSizeChange1"
          @current-change="handleCurrentChange1"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="size"
          :current-page="page"
          layout="total,sizes, prev, pager, next"
          :total="increaseDate.totalElements"
        >
        </el-pagination>
      </div>
    </el-tab-pane>
    <el-tab-pane label="代理开通记录" name="sixth">
      <AgentOpening></AgentOpening>
    </el-tab-pane>
    <el-tab-pane label="会员开通记录" name="seventh">
      <MembershipOpening></MembershipOpening>
    </el-tab-pane>
    <el-tab-pane label="打赏记录" name="tenth">
      <ExceptionalRecord></ExceptionalRecord>
    </el-tab-pane>
  </el-tabs>
</template>

<script>
import AgentOpening from "./components/AgentOpening";
import MembershipOpening from "./components/MembershipOpening";
import BonusWithdrawal from "./components/BonusWithdrawal";
import CollectStatistics from "./components/CollectStatistics";
import ExceptionalRecord from "./components/ExceptionalRecord";
import WePayDialog from "./components/WePayDialog.vue";
export default {
  components: {
    AgentOpening,
    MembershipOpening,
    BonusWithdrawal,
    CollectStatistics,
    ExceptionalRecord,
    WePayDialog,
  },
  data() {
    return {
      page: 1,
      size: 5,
      balance: -1,
      zhifubao: "",
      tkstatus: -1,
      platform: "all",
      phone: "",
      content: "",
      startTime: "",
      endTime: "",
      cashId: "",
      type: -1,
      totalnum: 0,
      totalnum2: 0,
      sqxTotal: "",
      userId: "",
      userTotal: "",
      taunTotal: "",
      relationId: "",
      sumMoneyByTime: "",
      activeName: "first",
      formLabelWidth: "200px",
      dialogFormVisible: false,
      tableDataLoading: false,
      userPhone: "",
      userPhoneTo: "",
      increaseDate: [],
      statisData: {},
      tableData: [],
      rechargeData: [],
      withdrawData: {},
      checkBoxData: [], //多选框选择的值
      type: 1,
      way: 3,
      form: {
        cashId: "",
        content: "",
      },
      item: "",
      info: {
        stockDate: this.getNowTime(), //日期
      },
      info2: {
        stockDate2: this.getNowTime2(), //日期
      },
      platforms: [
        {
          value: "all",
          label: "全部",
        },
        {
          value: "tb",
          label: "淘宝",
        },
        {
          value: "jd",
          label: "京东",
        },
        {
          value: "pdd",
          label: "拼多多",
        },
      ],
      ways: [
        {
          value: 3,
          label: "按天查询",
        },
        {
          value: 2,
          label: "按月查询",
        },
        {
          value: 1,
          label: "按年查询",
        },
      ],
      batchWechatDialogData: { paymentCode: "" }, // 微信转账弹窗数据
    };
  },
  methods: {
    // 订单分析选择日期
    animeOrder() {
      this.statiSelect();
    },
    // 会员详情跳转
    updates(row) {
      this.$router.push({ path: "/userDetail", query: { userId: row.userId } });
    },
    // 会员详情跳转
    updatesPhone(row) {
      this.$router.push({ path: "/userDetail", query: { userId: row.userId } });
    },
    // 会员详情跳转
    updatesPhoneTo(row) {
      this.$router.push({
        path: "/userDetail",
        query: { userId: row.userIdTo },
      });
    },
    // 批量转账
    transferClcik(id) {
      let _this = this;
      var ids = id
        ? [id]
        : this.checkBoxData.map((item) => {
            return item.id;
          });
      for (var i in ids) {
        _this
          .$http({
            url: _this.$http.adornUrl2(`/cash/update/${ids[i]}`),
            method: "post",
            data: _this.$http.adornData({}),
          })
          .then(({ data }) => {
            if (data.status == 0) {
              _this.$notify({
                title: "提示",
                duration: 1800,
                message: data.data,
                type: "warning",
              });
              return;
            } else {
              _this.$notify({
                title: "提示",
                duration: 1800,
                message: data.msg,
                type: "error",
              });
              return;
            }
          });
      }
    },
    // 查询
    selectincrease() {
      this.page = 1;
      this.size = 5;
      this.increaseSelect();
    },
    cleansincrease() {
      this.userPhone = "";
      this.userPhoneTo = "";
      this.increaseSelect();
    },
    // 多选
    changeFun(val) {
      this.checkBoxData = val;
    },
    cleans() {
      this.zhifubao = "";
      this.relationId = "";
      this.dataSelect();
    },
    //转账(支付宝)
    batch(row) {
      let cashId = row.id;
      if (row.state == 1) {
        this.$message({
          message: "已转账，请勿重复操作！",
          type: "error",
          duration: 2500,
        });
        return;
      }
      this.$confirm(`确定转账?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.$http({
          // /cash/alipay/{cashId}
          url: this.$http.adornUrl2(`/cash/alipay/${cashId}`),
          method: "post",
          data: this.$http.adornData(cashId, false),
        }).then(({ data }) => {
          if (data.status == 0) {
            this.$message({
              message: data.data,
              type: "success",
              duration: 1500,
              onClose: () => {
                this.dataSelect();
              },
            });
            return;
          } else {
            this.$message({
              message: data.msg,
              type: "error",
              duration: 2500,
            });
            return;
          }
        });
      });
    },
    // 转账(微信)弹窗
    batchWechat(row) {
      const { state, paymentCode, id: cashId } = row;
      if (state == 1) {
        this.$message({
          message: "已转账，请勿重复操作！",
          type: "error",
          duration: 2500,
        });
        return;
      }
      this.batchWechatDialogData = { paymentCode, cashId };
      this.$refs.wepayDialogRef.open();
    },
    // 转账(微信)确认
    confirmBatchWechat(cashId) {
      this.$confirm(`确定转账?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.$http({
          // /cash/update/{cashId}
          url: this.$http.adornUrl2(`/cash/update/${cashId}`),
          method: "post",
          data: this.$http.adornData(cashId, false),
        }).then(({ data }) => {
          if (data.status == 0) {
            this.$message({
              message: data.data,
              type: "success",
              duration: 1500,
              onClose: () => {
                this.$refs.wepayDialogRef.close();
                this.dataSelect();
              },
            });
            return;
          } else {
            this.$message({
              message: data.msg,
              type: "error",
              duration: 2500,
              onClose: () => {
                this.$refs.wepayDialogRef.close();
              },
            });
            return;
          }
        });
      });
    },
    // 退款
    refund(row) {
      if (row.state == -1) {
        this.$message({
          message: "已退款，请勿重复操作！",
          type: "error",
          duration: 2500,
        });
      } else {
        this.dialogFormVisible = true;
        this.form.cashId = row.id;
      }
    },
    // 退款操作
    refundNoticeTo() {
      if (this.form.content == "") {
        this.$message({
          message: "请输入退款原因！",
          type: "error",
          duration: 1500,
        });
        return;
      }
      this.$http({
        url: this.$http.adornUrl2(
          `/cash/v1/refund/${this.form.cashId}/${this.form.content}`
        ),
        method: "post",
        data: this.$http.adornData({}),
      }).then(({ data }) => {
        if (data.status == 0) {
          this.dialogFormVisible = false;
          this.$message({
            message: "操作成功",
            type: "success",
            duration: 1500,
            onClose: () => {
              this.form.content = "";
              this.dataSelect();
            },
          });
          return;
        }
        if (data.status == -100) {
          this.dialogFormVisible = false;
          this.$message({
            message: data.msg,
            type: "error",
            duration: 2500,
            onClose: () => {
              this.form.content = "";
            },
          });
          return;
        }
      });
    },
    timeDate() {
      this.withdrawSelect();
    },
    // 日期选择
    animeDat(value) {
      let vanumber = value;
      if (vanumber === 3) {
        this.withdrawSelect();
      }
      if (vanumber === 2) {
        this.item = this.info.stockDate;
        this.info.stockDate = this.info.stockDate.substring(0, 7);
        this.withdrawSelect();
        this.info.stockDate = this.item;
      }
      if (vanumber === 1) {
        this.item = this.info.stockDate;
        this.info.stockDate = this.info.stockDate.substring(0, 4);
        this.withdrawSelect();
        this.info.stockDate = this.item;
      }
    },
    //处理默认选中当前日期
    getNowTime() {
      var now = new Date();
      var year = now.getFullYear(); //得到年份
      var month = now.getMonth(); //得到月份
      var date = now.getDate(); //得到日期
      month = month + 1;
      month = month.toString().padStart(2, "0");
      date = date.toString().padStart(2, "0");
      var defaultDate = `${year}-${month}-${date}`;
      return defaultDate;
      this.$set(this.info, "stockDate", defaultDate);
    },
    //处理默认选中当前日期
    getNowTime2() {
      var now = new Date();
      var year = now.getFullYear(); //得到年份
      var month = now.getMonth() - now.getMonth(); //得到月份
      var date = now.getDate() - now.getDate() + 1; //得到日期
      month = month + 1;
      month = month.toString().padStart(2, "0");
      date = date.toString().padStart(2, "0");
      var defaultDate = `${year}-${month}-${date}`;
      return defaultDate;
      this.$set(this.info, "stockDate", defaultDate);
    },
    handleSizeChange(val) {
      this.size = val;
      this.dataSelect();
    },
    handleCurrentChange(val) {
      this.page = val;
      this.dataSelect();
    },
    handleSizeChange1(val) {
      this.size = val;
      this.rechargeSelect();
    },
    handleCurrentChange1(val) {
      this.page = val;
      this.rechargeSelect();
    },
    handleSizeChange2(val) {
      this.size = val;
      this.increaseSelect();
    },
    handleCurrentChange2(val) {
      this.page = val;
      this.increaseSelect();
    },
    // 刷新
    refresh() {
      this.dataSelect();
    },
    // 刷新
    refresh1() {
      this.rechargeSelect();
    },
    handleClick(tab, event) {
      if (tab._props.label == "提现管理") {
        this.page = 1;
        this.size = 5;
        this.dataSelect();
      }
      if (tab._props.label == "提现统计") {
        this.way = 3;
        this.withdrawSelect();
      }
      if (tab._props.label == "充值记录") {
        this.page = 1;
        this.size = 5;
        this.rechargeSelect();
      }
      if (tab._props.label == "充值统计") {
        this.statiSelect();
      }
      if (tab._props.label == "转赠记录") {
        this.increaseSelect();
      }
    },
    // 支付宝账号查询
    zfbselect() {
      if (this.zhifubao == "") {
        this.$notify({
          title: "提示",
          duration: 1800,
          message: "请输入支付宝账号",
          type: "error",
        });
        return;
      } else {
        this.tableDataLoading = true;
        this.$http({
          url: this.$http.adornUrl2(`/cash/phone/${this.zhifubao}`),
          method: "get",
          params: this.$http.adornParams({}),
        }).then(({ data }) => {
          this.tableDataLoading = false;
          let returnData = data.data;
          this.tableData = returnData;
          this.totalnum = returnData.length;
        });
      }
    },
    // 渠道账号查询
    qdselect() {
      if (this.relationId == "") {
        this.$notify({
          title: "提示",
          duration: 1800,
          message: "请输入渠道账号",
          type: "error",
        });
        return;
      } else {
        this.tableDataLoading = true;
        this.$http({
          url: this.$http.adornUrl2(`/cash/list/${this.relationId}`),
          method: "get",
          params: this.$http.adornParams({}),
        }).then(({ data }) => {
          this.tableDataLoading = false;
          let returnData = data.data;
          this.tableData = returnData;
          this.totalnum = returnData.length;
        });
      }
    },
    // 获取数据列表
    dataSelect() {
      this.tableDataLoading = true;
      this.$http({
        // /cash/alipay/{cashId}
        url: this.$http.adornUrl2(`/cash/page/${this.page - 1}/${this.size}/1`),
        method: "get",
        params: this.$http.adornParams({}),
      }).then(({ data }) => {
        this.tableDataLoading = false;
        let returnData = data.data;
        this.tableData = returnData.content;
        this.totalnum = returnData.totalElements;
      });
    },
    // 转赠记录
    increaseSelect() {
      this.tableDataLoading = true;
      let page = this.page - 1;
      this.$http({
        url: this.$http.adornUrl2("/moneyGiven/list"),
        method: "get",
        params: this.$http.adornParams({
          page: page,
          size: this.size,
          userPhone: this.userPhone,
          userPhoneTo: this.userPhoneTo,
        }),
      }).then(({ data }) => {
        this.tableDataLoading = false;
        let returnData = data.data;
        this.increaseDate = returnData;
      });
    },
    // 提现统计
    withdrawSelect() {
      this.$http({
        url: this.$http.adornUrl2("/statistics/getSumMoneyByTime"),
        method: "get",
        params: this.$http.adornParams({
          time: this.info.stockDate,
        }),
      }).then(({ data }) => {
        let returnData = data.data;
        this.withdrawData = returnData;
        this.sumMoneyByTime = parseFloat(returnData.sumMoneyByTime).toFixed(2);
      });
    },
    // 获取充值记录
    rechargeSelect() {
      if (this.endTime == "") {
        this.endTime = this.info.stockDate;
      }
      if (this.startTime == "") {
        this.startTime = this.info2.stockDate2;
      }
      this.tableDataLoading = true;
      this.$http({
        url: this.$http.adornUrl2(
          `/userMoney/userList?page=${this.page - 1}&size=${this.size}&type=${
            this.type
          }`
        ),
        method: "get",
        params: this.$http.adornParams({}),
      }).then(({ data }) => {
        this.tableDataLoading = false;
        let returnData = data.data;
        this.rechargeData = returnData.content;
        this.totalnum2 = returnData.totalElements;
      });
    },
    // 充值统计
    statiSelect() {
      this.$http({
        url: this.$http.adornUrl2("/statistics/sumPay"),
        method: "get",
        params: this.$http.adornParams({
          date: this.info.stockDate,
        }),
      }).then(({ data }) => {
        let returnData = data.data;
        this.statisData = returnData;
        // this.sumMoneyByTime = parseFloat(returnData.sumMoneyByTime).toFixed(2)
      });
    },
  },
  mounted() {
    this.dataSelect();
  },
};
</script>

<style scoped="scoped">
.box {
  height: 110px;
  padding: 24px;
  border: 1px solid #eee;
  margin: 15px 10px;
}

.box_num {
  font-size: 14px;
  color: #66b1ff;
}

.box_num .box_color {
  color: #333;
  font-size: 14px;
  margin-bottom: 15px;
}

.box_num div span {
  font-size: 20px;
  margin-left: 5px;
}

.text_color {
  color: #4f9dec;
}

.text_color span {
  margin-right: 5px;
}
</style>
